function x = CholeskyDecomposition(A,n)
%CholeskyDecomposition 利用Cholesky分解对称正定矩阵
%   此处显示详细说明
for k = 1:n
    A(k,k) = sqrt(A(k,k));
    A(k+1:n,k) = A(k+1:n,k)/A(k,k);
    for j = k+1:n
        A(j:n,j) = A(j:n,j) - A(j:n,k)*A(j,k);
    end
end
x = A;
end

